package com.zh.streamdemo.demo1;

import java.util.regex.Pattern;
import java.util.stream.Stream;

public class DemoFilter {

    public static void main(String[] args) {
        Stream.of("java", ".net", "python", "php", "c++").filter(item -> item.contains("n")).forEach(System.out::println);
        Stream.of("java", ".net", "python", "php", "c++").filter(DemoFilter::regexFilter).forEach(System.out::println);
    }

    private static boolean regexFilter(String item){
        String pt = "^[a-zA-Z]+";
        return Pattern.matches(pt, item);
    }
}
